package com.java.controller;

import com.java.dao.RepairEquipmentDao;
import com.java.entity.RepairEquipment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * 报修设备(RepairEquipment)表控制层
 *
 * @author 安能
 * @since 2020-07-01 11:27:42
 */
@RestController
@RequestMapping("RepairEquipment")
public class RepairEquipmentController {



    @Resource
    private RepairEquipmentDao repairEquipmentDao;


    @GetMapping("insert")
    public RepairEquipment insert(RepairEquipment repairEquipment) {
        repairEquipmentDao.insert(repairEquipment);
        return repairEquipment;
    }

    @GetMapping("selectList")
    public HashMap<String, Object> selectList(Integer id) {

        List<RepairEquipment> repairEquipments = repairEquipmentDao.selectList(null);

        HashMap<String, Object> map = new HashMap<>();
        map.put("code", 0);
        map.put("msg", "");
        map.put("count", repairEquipments.size());
        map.put("data", repairEquipments);
        return map;
    }
}